{% extends 'base.html' %} {% load staticfiles %} {% block title %}专线:{{ circuit.name }}{% endblock %} {% block content %}
<!-- Content Header (Page header) -->
<section class="content-header">
  <h1>专线详细</h1>
  <ol class="breadcrumb">
    <li><a href="{% url 'index' %}"><i class="fa fa-dashboard"></i> 主页</a></li>
    <li>资产总表</li>
    <li class="active">专线详细</li>
  </ol>
</section>

<!-- Main content -->
<section class="content">

  <!-- Default box -->
  <div class="box">
    <div class="box-body">
      <div class="nav-tabs-custom">
        <ul class="nav nav-tabs">
          <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="false">基本信息</a></li>
          <li class=""><a href="#tab_2" data-toggle="tab" aria-expanded="false">更新日志</a></li>
        </ul>
        <div class="tab-content">
          <div class="tab-pane active" id="tab_1">
            <div class="row">
              <div class="col-xs-2 text-right">专线名称:</div>
              <div class="col-xs-4">{{ circuit.name }}</div>
              <div class="col-xs-2 text-right">专线编号:</div>
              <div class="col-xs-4">{{ circuit.number }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">类型:</div>
              <div class="col-xs-4">{{ circuit.get_circuit_type_display }}</div>
              <div class="col-xs-2 text-right">带宽(M):</div>
              <div class="col-xs-4">{{ circuit.bw|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">状态:</div>
              <div class="col-xs-4">{{ circuit.get_status_display }}</div>
              <div class="col-xs-2 text-right">业务线:</div>
              <div class="col-xs-4">{{ circuit.get_business_unit_display }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">是否自用:</div>
              <div class="col-xs-4">{{ circuit.get_self_use_status_display }}</div>
              <div class="col-xs-2 text-right">用户:</div>
              <div class="col-xs-4">{{ circuit.customer|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">维护人:</div>
              <div class="col-xs-4">{{ circuit.maintainer|default:'' }}</div>
              <div class="col-xs-2 text-right">VLAN:</div>
              <div class="col-xs-4">{{ circuit.vlan|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">运营商:</div>
              <div class="col-xs-4">{{ circuit.isp|default:'' }}</div>
              <div class="col-xs-2 text-right">运营商接口人:</div>
              <div class="col-xs-4">{{ circuit.isp_contacts|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">运营商报障电话:</div>
              <div class="col-xs-4">{{ circuit.isp_contacts_phonenumber|default:'' }}</div>
              <div class="col-xs-2 text-right">裸纤长度(KM):</div>
              <div class="col-xs-4">{{ circuit.circuit_lenth|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">裸纤衰耗(dB):</div>
              <div class="col-xs-4">{{ circuit.attenuation|default:'' }}</div>
              <div class="col-xs-2 text-right">启用日期:</div>
              <div class="col-xs-4">{{ circuit.date_online|date:"Y-m-d" }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">拆除日期:</div>
              <div class="col-xs-4">{{ circuit.date_dismantle|date:"Y-m-d" }}</div>
              <div class="col-xs-2 text-right">云专线编号:</div>
              <div class="col-xs-4">{{ circuit.cloudnumber|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">起始端机房单元:</div>
              <div class="col-xs-4">{{ circuit.machineroom_a|default:'' }}</div>
              <div class="col-xs-2 text-right">终止端机房单元:</div>
              <div class="col-xs-4">{{ circuit.machineroom_z|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">起始端机架:</div>
              <div class="col-xs-4">{{ circuit.cabinet_a|default:'' }}</div>
              <div class="col-xs-2 text-right">终止端机架:</div>
              <div class="col-xs-4">{{ circuit.cabinet_z|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">起始端设备:</div>
              <div class="col-xs-4">{{ circuit.networkdevice_a.hostname|default:'' }}</div>
              <div class="col-xs-2 text-right">终止端设备:</div>
              <div class="col-xs-4">{{ circuit.networkdevice_z.hostname|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">起始端设备端口:</div>
              <div class="col-xs-4">{{ circuit.port_a.asset|default:'' }}</div>
              <div class="col-xs-2 text-right">终止端设备端口:</div>
              <div class="col-xs-4">{{ circuit.port_z.asset|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">DWDM:</div>
              <div class="col-xs-6">
                {% if circuit.dwdm %}
                  <a href="{% url 'dwdmdetail' circuit.dwdm.id %}" target=_blank> {{ circuit.dwdm|default:'' }} </a>
                {% else %}
                  {{ circuit.dwdm|default:'' }}
                {% endif %}
              </div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">路由:</div>
              <div class="col-xs-6">{{ circuit.router|default:'' }}</div>
            </div>
            <br>
            <div class="row">
              <div class="col-xs-2 text-right">备注:</div>
              <div class="col-xs-6">{{ circuit.memo|default:'' }}</div>
            </div>
            <br>
            <p style=" margin:0 auto; text-align:center;">
              <button class="btn btn-default " align="center" data-toggle="modal" data-target="#circuitEditModal">修改</button>
            </p>
          </div>
          <form class="form-horizontal" action="{% url 'circuitdetail' circuit.id %}" method="post">
            {% csrf_token %}
            <div class="modal fade" id='circuitEditModal' tabindex="-1" role="dialog" aria-labelledby='myModelLabel' aria-hidden="true">
              <div class="modal-dialog modal-lg">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">专线修改</h4>
                  </div>
                  <div class="modal-body">
                    <form class="form-horizontal" role="form">
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">专线名称:</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control" type="text" name='name' value= {{ circuit.name|default:'' }}>
                      </div>
                    </div>
                    <div class="form-group">  
                      <label for="modify" class="col-sm-2 control-label">专线编号:</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control" type="text" name='number' value= {{ circuit.number|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">类型:</label>
                      <div class="col-sm-3">
                        <select class="selector input-sm" name='circuit_type'>
                          <option value='0' {% if circuit.circuit_type == 0 %} selected="selected" {% endif %}>Fiber</option>
                          <option value='1' {% if circuit.circuit_type == 1 %} selected="selected" {% endif %}>DWDM</option>
                          <option value='2' {% if circuit.circuit_type == 2 %} selected="selected" {% endif %}>LAN</option>
                          <option value='2' {% if circuit.circuit_type == 3 %} selected="selected" {% endif %}>SDH</option>
                        </select>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">带宽(M):</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='bw' value= {{ circuit.bw|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">状态:</label>
                      <div class="col-sm-3">
                        <select class="selector input-sm" name='status'>
                          <option value='0' {% if circuit.status == 0 %} selected="selected" {% endif %}>运营</option>
                          <option value='1' {% if circuit.status == 1 %} selected="selected" {% endif %}>拆除</option>
                          <option value='2' {% if circuit.status == 2 %} selected="selected" {% endif %}>待启用</option>
                        </select>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">业务线:</label>
                      <div class="col-sm-3">
                        <select class="selector input-sm" name='business_unit'>
                          <option value='0' {% if circuit.business_unit == 0 %} selected="selected" {% endif %}>领骏</option>
                          <option value='1' {% if circuit.business_unit == 1 %} selected="selected" {% endif %}>驰联</option>
                        </select>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">是否自用:</label>
                      <div class="col-sm-3">
                        <select class="selector input-sm" name='self_use_status'>
                          <option value='0' {% if circuit.self_use_status == 0 %} selected="selected" {% endif %}>是</option>
                          <option value='1' {% if circuit.self_use_status == 1 %} selected="selected" {% endif %}>否</option>
                        </select>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">用户:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='customer' value= {{ circuit.customer|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">维护人:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='maintainer' value= {{ circuit.maintainer|default:'' }}>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">VLAN:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='vlan' value= {{ circuit.vlan|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">运营商:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='isp' value= {{ circuit.isp|default:'' }}>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">运营商接口人:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='isp_contacts' value= {{ circuit.isp_contacts|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">运营商报障电话:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='isp_contacts_phonenumber' value= {{ circuit.isp_contacts_phonenumber|default:'' }}>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">裸纤长度(KM):</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='circuit_lenth' value= {{ circuit.circuit_lenth|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">裸纤衰耗(dB):</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='attenuation' value= {{ circuit.attenuation|default:'' }}>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">启用日期:</label>
                      <div class="col-sm-3">
                        <input type="date" class="form-control" name='date_online' value= {{ circuit.date_online|date:"Y-m-d" }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">拆除日期:</label>
                      <div class="col-sm-3">
                        <input type="date" class="form-control" name='date_dismantle' value= {{ circuit.date_dismantle|date:"Y-m-d" }}>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">云专线编号:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='cloudnumber' value= {{ circuit.cloudnumber|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">起始端机房单元:</label>
                      <div class="col-sm-3">
                         <select class="form-control" id='machineroom' name='machineroom_a'>
                           <option value='' {% if circuit.machineroom_a == '' %} selected="selected" {% endif %}>请选择</option>
                           {% for machineroom in machineroom %}
                           <option value={{ machineroom }}  {% if circuit.machineroom_a == machineroom %} selected="selected" {% endif %}>{{ machineroom }}</option>
                           {% endfor %}
                         </select>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">终止端机房单元:</label>
                      <div class="col-sm-3">
                         <select class="form-control" id='machineroom' name='machineroom_z'>
                           <option value='' {% if circuit.machineroom_z == '' %} selected="selected" {% endif %}>请选择</option>
                           {% for machineroom in machineroom %}
                           <option value={{ machineroom }}  {% if circuit.machineroom_z == machineroom %} selected="selected" {% endif %}>{{ machineroom }}</option>
                           {% endfor %}
                         </select>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">起始端机架:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='cabinet_a' value= {{ circuit.cabinet_a|default:'' }}>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">终止端机架:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='cabinet_z' value= {{ circuit.cabinet_z|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">起始端设备:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='networkdevice_a' value= {{ circuit.networkdevice_a.hostname|default:'' }}>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">终止端设备:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='networkdevice_z' value= {{ circuit.networkdevice_z.hostname|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">起始端设备端口:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='port_a' value= {{ circuit.port_a|default:'' }}>
                      </div>
                      <label for="modify" class="col-sm-2 control-label">终止端设备端口:</label>
                      <div class="col-sm-3">
                        <input type="text" class="form-control" type="text" name='port_z' value= {{ circuit.port_z|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">DWDM:</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control" type="text" name='dwdm' value= {{ circuit.dwdm|default:'' }}>
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">路由:</label>
                      <div class="col-sm-8">
                        <textarea rows='1' class="form-control" name='router'>{{ circuit.router|default:'' }}</textarea>
                      </div>
                    </div>
                    <div class="form-group">  
                      <label for="modify" class="col-sm-2 control-label">备注:</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control" type="text" name='memo' value= {{ circuit.memo|default:'' }}>
                      </div>  
                    </div>
                    <div class="form-group">
                      <label for="modify" class="col-sm-2 control-label">修改原因:<font color='#ff0000'>*</font></label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control" type="textarea" name='reason' required>
                      </div>
                    </div>
                    </form>
                  </div>  
                  <div class="modal-footer">
                    <button type="submit" name="submit" value="circuit_edit" class="btn btn-primary">确认</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                  </div>
                </div>
              </div>
            </div>
          </form>

          <!-- /.tab-pane tab_1 -->
          <div class="tab-pane" id="tab_2">
            <h4><b>日志信息:</b></h4>
            <table id="eventlog_table" border="1" class="display table table-bordered table-striped">
              <thead>
                <tr>
                  <th>类型</th>
                  <th>详细内容</th>
                  <th>操作原因</th>
                  <th>操作时间</th>
                  <th>操作人</th>
                </tr>
              </thead>
              <tbody>
                {% for log in eventlog %}
                <tr>
                  <td id="log_event_type">{{ log.get_event_type_display }}</td>
                  <td id="log_detail">{{ log.detail }}</td>
                  <td id="log_reason">{{ log.reason }}</td>
                  <td id="log_date">{{ log.date|date:"Y-m-d H:i:s" }}</td>
                  <td id="log_user">{{ log.user }}</td>
                </tr>
                {% empty %}
                <tr>没有日志信息！</tr>
                {% endfor %}
              </tbody>
            </table>
          </div>
          <!-- /.tab-pane tab_2 -->
        </div>
      </div>
    </div>
    <!-- /.box-body -->
    <div class="box-footer">
      <i class="fa fa-angle-double-left"></i>&nbsp;&nbsp;<a href="{% url 'index' %}"><strong>返回资产列表页</strong></a>
    </div>
    <!-- /.box-footer-->
  </div>
  <!-- /.box -->

</section>
<!-- /.content -->
{% endblock %}
